package net.starwifi.duobao.web;

import net.starwifi.duobao.mvc.BaseController;
import net.starwifi.duobao.mvc.Order;
import net.starwifi.duobao.mvc.PageView;
import net.starwifi.duobao.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2015/11/13.
 */
@Controller("orderController")
@RequestMapping("/bCenter/order")
public class OrderController extends BaseController {


    @Autowired
    OrderService orderService;


    /**
     * 未处理订单
     */
    @RequestMapping(value = "/will-do", method = RequestMethod.GET)
    public String listWillDo(PageView pageView, ModelMap model,HttpServletRequest request) {
        pageView.filterQuery(request);
        pageView.addOrder(Order.desc("id"));
        model.addAttribute("page", orderService.getScrollData(pageView));
        return "bcenter/order-will-do";
    }

    /**
     * 订单列表
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public String list(PageView pageView, ModelMap model,HttpServletRequest request) {
        pageView.filterQuery(request);
        pageView.addOrder(Order.desc("id"));
        model.addAttribute("page", orderService.getScrollData(pageView));
        return "bcenter/order-list";
    }

}
